<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>反馈</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <style>
        html,
        body {
            font-size: 14px;
            height: 100%;
        }

        header {
            position: fixed;
            top: 0;
            width: 100%;
            height: 75px;
            text-align: left;
            background-color: #fff;
            border-bottom: 1px solid #f2f2f2;
        }

        header .back {
            position: relative;
            margin-top: 38px;
            width: 100%;
            height: 1.5rem;
            text-align: center;
        }

        .back img {
            position: absolute;
            left: 1rem;
            width: 1.5rem;
            height: 1.5rem;
            vertical-align: middle;
        }

        main {
            padding-top: 75px;
        }

        .email {
            width: 90%;
            margin: 1rem auto;
        }
        .email span {
          color: #FBB40E;
        }
        .feedbox {
            width: 90%;
            margin: auto;
        }

        .feedbox span {
            margin-bottom: 0.5rem;
            color: #FBB40E;
        }

        .feedbox textarea {
            padding: 0.5rem;
            box-sizing: border-box;
            width: 100%;
            resize: none;
            background-color: #f2f2f2;
        }

        .feedbox .submit {
            width: 100%;
            padding: 0.5rem 0;
            color: #fff;
            text-align: center;
            background-color: #2C87F7;
            border-radius: 0.35rem;
        }
    </style>
</head>

<body>
    <header>
        <div class="back">
            <img src="../image/icon/back.png" alt="" onclick="api.closeWin()">
            <span>意见反馈</span>
        </div>
    </header>
    <main>
        <div class="email">
            <span>你的邮箱:</span>
            <input type="text" value="" placeholder="请输入您的邮箱" id="email">
        </div>
        <div class="feedbox">
            <span>反馈信息</span>
            <textarea name="name" rows="8" maxlength="100" placeholder="请输入您的反馈信息" id="feedinfo"></textarea>
            <div class="submit">提交</div>
        </div>
    </main>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
    apiready = function() {

    };

    $('.submit').click(function() {
        var email = $('#email').val();
        var feedinfo = $('#feedinfo').val();
        var reg = new RegExp("^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-z]{2,}$");
        if (!email) {
            api.toast({
                msg: '请输入邮箱',
                duration: 2000,
                location: 'bottom'
            })
            return
        }
        if (!feedinfo) {
            api.toast({
                msg: '请输入反馈信息',
                duration: 2000,
                location: 'bottom'
            })
            return
        }
        if (!reg.test(email)) {
            api.toast({
                msg: '邮箱格式不正确',
                duration: 2000,
                location: 'bottom'
            })
            return
        }
        api.toast({
            msg: '提交成功，感谢您的反馈！',
            duration: 2000,
            location: 'bottom'
        });
        setTimeout(function() {
            api.closeWin({
                name: 'feedback'
            });
        }, 1000)
    })
</script>

</html>
